<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Template • TodoMVC</title>
	<link rel="stylesheet" href="./node_modules/todomvc-app-css/index.css">
	<link rel="stylesheet" href="./node_modules/todomvc-common/base.css">
	<!-- CSS overrides - remove if you don't need it -->
</head>

<body>
	<!--
			todomvc 案例的所有真实内容
		-->
	<section class="todoapp" id="todoApp">
		<!--
				头部区域
			-->
		<header class="header">
			<!-- 标题 -->
			<h1>todos · Vue</h1>
			<!--
					文本框, 添加新任务的文本框
				-->
			<input class="new-todo" placeholder="你需要添加什么任务 ?" v-model.trim="inputValue" v-focus @keyup.enter="addTodo">
		</header>
		<template v-if="todos.length">
			<!-- This section should be hidden by default and shown when there are todos -->
			<section class="main" >
				<!-- 全选按钮的复选框 -->
				<input id="toggle-all" class="toggle-all" type="checkbox" @click="toggleAll($event)" :checked="checkAllStatus">
				<!-- 和全选按钮关联的 label -->
				<label for="toggle-all">Mark all as complete</label>
				<!-- 所有的 todolist 列表 -->
				<ul class="todo-list">
					<!-- 每一个 li 都是一个任务 -->
					<!-- These are here just to show the structure of the list items -->
					<!--
						List items should get the class `editing` when editing
						and `completed` when marked as completed -->
					<!--
						当你给 li 添加一个叫做 editing 类名的时候, 会进入编辑状态
						  => 被隐藏的编辑文本框就会显示出来了
						当你给 li 添加一个叫做 completed 类名的时候, 会把本条任务变成完成状态
						  => label 标签内的文本会带有中划线样式
						当你给 li 不设置类名的时候
						  => 就是未完成的状态, 普通状态
					-->
					<li v-for="todo in filterTodos" :class="{completed:todo.completed,editing:todo.isEditing}">
						<!-- 任务相关内容 -->
						<div class="view">
							<!-- 复选框, 有 checked 属性就是选中, 没有 checked 就是未选中 -->
							<input class="toggle" type="checkbox" v-model="todo.completed">
							<!-- 当前的任务内容 -->
							<label @dblclick="editTodo(todo.id)">{{todo.content}}</label>
							<!-- 每一条任务的删除按钮 -->
							<button class="destroy" @click="removeTodo(todo.id)"></button>
						</div>
						<!-- 编辑文本框 -->
						<!-- 默认隐藏的 -->
						<input class="edit" v-model="todo.content" @blur="exitEdit(todo.id,$event)" @keyup.enter="exitEdit(todo.id,$event)" v-editing-focus="todo.isEditing">
					</li>
				</ul>
			</section>
			<!-- This footer should be hidden by default and shown when there are todos -->
			<footer class="footer">
				<!-- This should be `0 items left` by default -->
				<!--
					统计有多少活动的 任务 的数量
				-->
				<span class="todo-count"><strong>{{leftCount}}</strong> item left</span>
				<!-- Remove this if you don't implement routing -->
				<ul class="filters">
					<!-- 三个状态切换显示标签 -->
					<li>
						<!-- 查看所有任务 -->
						<a :class="{selected:filterStatus==='all'}" href="#/">All</a>
					</li>
					<li>
						<!-- 查看所有未完成 -->
						<a :class="{selected:filterStatus==='active'}" href="#/active">Active</a>
					</li>
					<li>
						<!-- 查看所有已完成 -->
						<a :class="{selected:filterStatus==='completed'}" href="#/completed">Completed</a>
					</li>
				</ul>
				<!-- Hidden if no completed items are left ↓ -->
				<!--
					删除所有已完成 按钮
					  + 默认隐藏
						+ 有已完成任务的时候才会显示
				-->
				<button class="clear-completed" @click="removeAllCompleted">Clear completed</button>
			</footer>
		</template>
	</section>
	<footer class="info">
		<p>Double-click to edit a todo</p>
		<!-- Remove the below line ↓ -->
		<p>Template by <a href="javascript:;">Sindre Sorhus</a></p>
		<!-- Change this out with your name and url ↓ -->
		<p>Created by <a href="javascript:;">you</a></p>
		<p>Part of <a href="javascript:;">TodoMVC</a></p>
	</footer>
	<script src="node_modules/vue/dist/vue.js"></script>
	<script src="node_modules/todomvc-common/base.js"></script>
	<script src="./js/app.js"></script>
</body>

</html>